﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using CSharpDesign.DAL;
using CSharpDesign.Scripts;
using CSharpDesign.BLL;

namespace CSharpDesign
{
    public partial class MyOrder : System.Web.UI.Page
    {
        SqlHelper data = new SqlHelper();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Get_Info();
            }
        }
        protected void gvInfo_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {


        }
        protected void gvOrderInfo_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            gvOrderInfo.PageIndex = e.NewPageIndex;
            Get_Info();

        }
        private void Get_Info()
        {
            try
            {
                gvOrderInfo.DataSource = GetCodeBy(0);
                gvOrderInfo.DataBind();
            }
            catch
            {

            }

        }

        protected void gvInfo_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            try
            {
                MyOrderService.gvInfo_RowDataBounds(e);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public DataSet GetCodeBy(int iCount)
        {
            SqlConnection con;
            SqlDataAdapter da;
            DataSet ds;
            string username = Session["UserName"].ToString();
            try
            {
                Session["con"] = MyOrderService.GetCode(iCount, out con, out da, out ds, username);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con = (SqlConnection)Session["con"];
                con.Close();
            }
            return ds;
        }
    }

}